package com.ctz.commonframe.ui.view;

import android.app.Dialog;
import android.content.Context;
import android.graphics.drawable.AnimationDrawable;
import android.view.Window;
import android.widget.ImageView;


import com.ctz.commonframe.R;

public class LoadingDialog extends Dialog {
	private AnimationDrawable animationDrawable;

	public LoadingDialog(Context context) {
		super(context, R.style.DialogTheme);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.loading);
		setCanceledOnTouchOutside(false);
		ImageView loadingView = findViewById(R.id.iv_loading);
        animationDrawable = (AnimationDrawable) loadingView.getDrawable();
	}
    

	@Override
	public void show() {
		if(animationDrawable != null)
			animationDrawable.start();
		super.show();

	}

	@Override
	public void dismiss() {
		if(animationDrawable != null)
			animationDrawable.stop();
		super.dismiss();
	}
}
